import { fromJS } from 'immutable'
import defaultState from '../state/cookbook'
import method from '../method/cookbookMethod'

const reducer = (state = defaultState, action) => {
  try {
    let data = fromJS(action.data)
    return method[action.type](state,data)
  } catch (error) {
    return state
  }
}
export default reducer